feat(viewer): inline comment threads in a popover on narrow screens#562
Merged
Conversation
Below the 952px container-query breakpoint the right-margin comment column is hidden, so tapping a highlighted passage previously did nothing — inline-comment threads were unreachable on narrow windows and phones. This adds a popover that surfaces them there. - Extract a shared CommentPanel from CommentSidebar (a `pin` prop gates the margin-column padding/visibility pinning), wrapped by the wide aside and the new CommentPopover. - Track a `narrow` layout signal from a ResizeObserver on the layout container (the pattern Breadcrumbs already uses), gating the aside vs the popover so the same panel mounts in exactly one place. - CommentPopover: a free-mode Popover anchored to the highlight in article coordinates — fixed 288px width (matching the sidebar card), centered on the highlight and clamped on-screen, with a gap below it at the page bottom. - Dismissal handled in-component so it can exempt highlight clicks (tap another highlight to switch, not close) and defer Escape to CommentForm (blur the reply/draft field, including mid-IME-composition, instead of tearing down the thread). Labelled role="group" "Comments" (non-modal; no over-promised dialog focus semantics). - View/reply/resolve/delete, compose-new, n/p navigation, and the r focus-reply shortcut + per-thread reply drafts all work in the popover. Unit tests for the breakpoint and clamp helpers; Playwright e2e covering open, dismiss, compose, switch, n/p, r, reply-draft persistence, and the wide-screen control. svelte-check clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Below the 952px container-query breakpoint the right-margin comment column is hidden, so tapping a highlighted passage previously did nothing — inline-comment threads were unreachable on narrow windows and phones. This surfaces them in a popover.
What changed
CommentPanelextracted fromCommentSidebar(apinprop gates the margin-column padding/visibility pinning), wrapped by both the wide aside and the newCommentPopover.narrowlayout signal from aResizeObserveron the layout container (the patternBreadcrumbsalready uses), gating aside-vs-popover so the panel mounts in exactly one place.CommentPopover— a free-modePopoveranchored to the highlight in article coordinates: fixed 288px width (matching the sidebar card), centered on the highlight and clamped on-screen, with a gap below it at the page bottom.CommentForm(blur the reply/draft field, including mid-IME-composition, instead of tearing down the thread). Labelledrole="group""Comments" — non-modal, no over-promised dialog focus semantics.n/pnavigation, and therfocus-reply shortcut + per-thread reply drafts all work in the popover.Tests
n/p,r, reply-draft persistence, and the wide-screen control.🤖 Generated with Claude Code